package com.example.demo.study.proxy.dynamic.jdk;



import com.example.demo.study.proxy.staticproxy.IWork;
import com.example.demo.study.proxy.staticproxy.Leader;

import java.lang.reflect.Proxy;

public class TestApp {
    //条件：类需要实现接口
    //原理；借助反射+InvocationHandler
    public static void main(String[] args) {
        Leader leader = new Leader();
        IWork proxy = (IWork) Proxy.newProxyInstance(Leader.class.getClassLoader(),
                new Class[]{IWork.class}, new WorkInvocationHandler(leader));
        proxy.meeting();
        proxy.evaluate("Joy");
        proxy.evaluate("James");
    }


}
